#include<iostream>
#include<queue>
#include<stack>
#include<deque>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<iomanip>
#include<map>
#include<set>
#include<bitset>
#define ll long long
#define T int t; cin>>t; while(t--)
#define pb push_back
#define vv vector
#define ss string
#define so(vec) sort(vec.begin(), vec.end())
#define srt(vec) sort(vec.rbegin(), vec.rend())
#define s(s) sort(s.begin(), s.end())
#define all(vec) vec.begin(), vec.end()
#define sor(arr,n) sort(arr, arr+n)
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define Mod 10000000007
const double PI = 3.14159265358979323846;
using namespace std;
void HaiDO0da() {
ios_base::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
}
int main()
{
/////////////////////// Kendeine inan ve hep mutlu ol//////////////////////////////
HaiDO0da();
// freopen("hello.in", "r", stdin);
T{
int n,f=1; cin>>n;
ss x; cin>>x;
vector<pair<char, int>>vec(130);
for (int i = 0; i < n; i++) {
if (vec[x[i]].second == 0) {
if (i % 2 == 0) {
vec[x[i]].second = 1;
}
else
vec[x[i]].second = 2;
}
}
for (int i = 1; i < n; i++) {
if (vec[x[i]].second == vec[x[i-1]].second) {
f = false;
break;
}
}
if (f) yes;
else no;
}
}
630C - Lucky Numbers | 1208B - Uniqueness |
1384A - Common Prefixes | 371A - K-Periodic Array |
1542A - Odd Set | 1567B - MEXor Mixup |
669A - Little Artem and Presents | 691B - s-palindrome |
851A - Arpa and a research in Mexican wave | 811A - Vladik and Courtesy |
1006B - Polycarp's Practice | 1422A - Fence |
21D - Traveling Graph | 1559B - Mocha and Red and Blue |
1579C - Ticks | 268B - Buttons |
898A - Rounding | 1372B - Omkar and Last Class of Math |
1025D - Recovering BST | 439A - Devu the Singer and Churu the Joker |
1323A - Even Subset Sum Problem | 1095A - Repeating Cipher |
630F - Selection of Personnel | 630K - Indivisibility |
20B - Equation | 600B - Queries about less or equal elements |
1015A - Points in Segments | 1593B - Make it Divisible by 25 |
680C - Bear and Prime 100 | 1300A - Non-zero |